#pragma once
#include <list>
#include "Object.h"
using namespace std;
class Object;
class Box;
class SweptAABB;
class StaticObject;
class QuadTree
{
private:
	list<QuadTree*> _listQNode;
	list<Object*> _listObject;
	list<Box*> _listBox;
	list<StaticObject*> _listStaticObject;
	Box* _box;
	int _qtWidth;
	int _qtHeight;
public:
	QuadTree(void);
	QuadTree(Box* b);
	~QuadTree(void);
	//insert object into the world quadtree
	void insert(Object* obj);
	void insert(Box* box);
	void insert(StaticObject* st);
	//get list object likely collidie with object parameter
	list<Object*> query(Object* obj);
	list<Box*> query(Box* box);
	list<Object*> queryObject(Box* box);
	list<StaticObject*> query_staticObj(Box* obj);
	//clear list object of quadtree
	void clear();
	int count();
	bool Exists(ObjectType id);
private:
	//device the world	
	bool split(Box* box);
	//check if b2 is coverd by b1
	bool isCover(Box* b1, Box* b2);
};

